package com.ygqh.baby.controller.admin;

import com.ygqh.baby.utils.DateConvertUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 〈〉
 *
 * @author guohao
 * @date 2019/2/22 10:30
 * @since 1.0.0
 */
@RequestMapping("/admin/test")
@Controller
public class TestController {

    @RequestMapping("/test")
    @ResponseBody
    public Object test(int index) {
        Map<String, String> map = new HashMap<>();
        map.put("第" + index + "次调用", index + "");
        System.out.println("第" + index + "次调用" );
        try {
            Thread.sleep(20000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        map.put("time", DateConvertUtils.formatDateTime(new Date(System.currentTimeMillis())));
        return map;
    }
}
